import { createRouter, createWebHistory } from 'vue-router'


// @ts-ignore
const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path:'/',
      name:'欢迎页',
      component:() => import('../views/Base.vue'),
    },
    {
      path:'/login',
      name:'baselogin',
      component:() => import('@/components/account/Login.vue'),
      children:[
        {
          path:'',
          name:'account',
          component:() => import('@/components/account/LoginByAccountPage.vue')
        },
        {
          path:'/login/phone',
          name:'phone',
          component:() => import('@/components/account/LoginByPhonePage.vue')
        }
      ]
    },
    {
      path:'/register',
      name:'register',
      component:() => import('@/components/account/Register.vue')
    },
    {
      path:'/index',
      name:'main',
      component:() => import('@/views/Main.vue'),
      children:[
        {
          path: '',
          name:'index',
          component :() => import('@/components/main/index.vue')
        },
        {
          path : '/categories',
          name : 'categories',
          component :() => import('@/components/main/categories.vue')
        },
        {
          path : '/categories/:catid',
          name : 'catItem',
          component :() => import('@/components/main/catItem.vue')
        },
        {
          path : '/categories/:catid/:productId',
          name : 'proItem',
          component :() => import('@/components/main/ProductItem.vue'),
        },
        {
        path: '/account/:userid',
        name : 'accountInfo',
        component : () => import('@/components/account/Index/index.vue')
        }
      ]
    }
  ]
})

export default router
